home *** CD-ROM | disk | FTP | other *** search
/ Chip 2005 August (Alt) / CHIP 2005-08.1.iso / program / guvenlik / syslinux-3.07.exe / sample / Makefile < prev    next >
Encoding:
Makefile  |  2005-01-03  |  2.0 KB  |  78 lines

  1. #ident "$Id: Makefile,v 1.23 2005/01/03 08:23:16 hpa Exp $"
  2. ## -----------------------------------------------------------------------
  3. ##   
  4. ##   Copyright 2001-2004 H. Peter Anvin - All Rights Reserved
  5. ##
  6. ##   This program is free software; you can redistribute it and/or modify
  7. ##   it under the terms of the GNU General Public License as published by
  8. ##   the Free Software Foundation, Inc., 53 Temple Place Ste 330,
  9. ##   Boston MA 02111-1307, USA; either version 2 of the License, or
  10. ##   (at your option) any later version; incorporated herein by reference.
  11. ##
  12. ## -----------------------------------------------------------------------
  13.  
  14. ##
  15. ## samples for syslinux users
  16. ##
  17.  
  18. gcc_ok   = $(shell if gcc $(1) -c -x c /dev/null -o /dev/null 2>/dev/null; \
  19.                then echo $(1); else echo $(2); fi)
  20.  
  21. M32       := $(call gcc_ok,-m32,) $(call gcc_ok,-ffreestanding,)
  22.  
  23. CC         = gcc $(M32)
  24. LD         = ld -m elf_i386
  25. AR       = ar
  26. NASM       = nasm
  27. RANLIB       = ranlib
  28. CFLAGS     = -W -Wall -march=i386 -Os -fomit-frame-pointer -I../com32/include
  29. SFLAGS     = -march=i386
  30. LDFLAGS    = -s
  31. OBJCOPY    = objcopy
  32. PPMTOLSS16 =     ../ppmtolss16
  33. LIB       = liboldcom32.a
  34.  
  35. LIBOBJS       = conio.o atou.o skipatou.o printf.o c32exit.o
  36.  
  37. .SUFFIXES: .lss .c .o .elf .c32
  38.  
  39. all: syslogo.lss comecho.com hello.c32 hello2.c32 filetest.c32 c32echo.c32 \
  40.      fd.c32 $(LIB)
  41.  
  42. .PRECIOUS: %.o
  43. %.o: %.S
  44.     $(CC) $(SFLAGS) -c -o $@ $<
  45.  
  46. .PRECIOUS: %.o
  47. %.o: %.c
  48.     $(CC) $(CFLAGS) -c -o $@ $<
  49.  
  50. .PRECIOUS: %.elf
  51. %.elf: c32entry.o %.o $(LIB)
  52.     $(LD) -Ttext 0x101000 -e _start -o $@ $^
  53.  
  54. %.c32: %.elf
  55.     $(OBJCOPY) -O binary $< $@
  56.  
  57. %.com: %.asm
  58.     $(NASM) -f bin -o $@ -l $*.lst $<
  59.  
  60. $(LIB): $(LIBOBJS)
  61.     rm -f $@
  62.     $(AR) cq $@ $^
  63.     $(RANLIB) $@
  64.  
  65. syslogo.lss:    syslogo.png $(PPMTOLSS16)
  66.     pngtopnm syslogo.png | \
  67.         $(PPMTOLSS16) \#000000=0 \#d0d0d0=7 \#f6f6f6=15    \
  68.         > syslogo.lss
  69.  
  70. tidy:
  71.     rm -f *.o *.a *.lst *.elf
  72.  
  73. # Don't specify *.com since mdiskchk.com can't be built using Linux tools
  74. clean: tidy
  75.     rm -f *.lss *.o *.c32 comecho.com
  76.  
  77. spotless: clean
  78.